package com.example.wanjinyou.controller;


import com.example.wanjinyou.service.CommentService;
import com.example.wanjinyou.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Mr.Chen
 * @since 2022-10-20
 */

@RestController
@RequestMapping("/comments")
public class CommentController {
    @Autowired
    private CommentService commentService;

    /**
     * 获取评论列表
     * @param articleId
     * @return
     */
    @GetMapping("articles/{id}")
    public Result comments(@PathVariable("id") Long articleId) {
        return commentService.commentsByArticleId(articleId);
    }


}

